<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>

	
		<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
		<meta http-equiv="Content-Language" content="en-us">

		<title>Django | Form Media | Django Documentation</title>

		<meta name="ROBOTS" content="ALL">
		<meta http-equiv="imagetoolbar" content="no">
		<meta name="MSSmartTagsPreventParsing" content="true">
		<meta name="Copyright" content="This site's design and contents Copyright (c) 2005  Lawrence Journal-World.">

		<meta name="keywords" content="Python, Django, framework, open-source">
		<meta name="description" content="Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.">

		<link href="Django%20%7C%20Form%20Media%20%7C%20Django%20Documentation_files/base.css" rel="stylesheet" type="text/css" media="screen">
		<link href="Django%20%7C%20Form%20Media%20%7C%20Django%20Documentation_files/print.css" rel="stylesheet" type="text/css" media="print">
      
  
  <style type="text/css" media="screen">
    #docs-search {
      color: #000;
      float: right;
    }
    #docs-search form {
      font-size: 92%;
      margin: 0;
      padding: 1em 1em 0;
      white-space: nowrap;
    }
    form.search ul {
      list-style: none;
      margin: 0;
      padding: 0;
    }
    form.search li {
      display: inline;
      padding-right: 1em;
    }
    form.search .query {
      width: 18em;
    }
  </style>
  <link rel="stylesheet" href="Django%20%7C%20Form%20Media%20%7C%20Django%20Documentation_files/pygments.css" type="text/css">

	</head><body id="documentation" class="default">

	<div id="container">
		<div id="header">
			<h1 id="logo"><a href="http://www.djangoproject.com/"><img src="Django%20%7C%20Form%20Media%20%7C%20Django%20Documentation_files/hdr_logo.gif" alt="Django"></a></h1>
			<ul id="nav-global">
				<li id="nav-homepage"><a href="http://www.djangoproject.com/">Home</a></li>
				<li id="nav-download"><a href="http://www.djangoproject.com/download/">Download</a></li>
				<li id="nav-documentation"><a href="http://docs.djangoproject.com/">Documentation</a></li>
				<li id="nav-weblog"><a href="http://www.djangoproject.com/weblog/">Weblog</a></li>
				<li id="nav-community"><a href="http://www.djangoproject.com/community/">Community</a></li>
				<li id="nav-code"><a href="http://code.djangoproject.com/">Code</a></li>
			</ul>
		</div>
		<!-- END Header -->
		<div id="billboard">
  <h2><a href="http://docs.djangoproject.com/en/1.0/">Django documentation</a></h2>
</div>
		<div id="columnwrap">
			
		<div id="content-main">
		


  <h2 class="deck">
  
    This document describes Django version 1.0. For development documentation, 
    <a href="http://docs.djangoproject.com/en/dev/topics/forms/media/">go here</a>.
  
  </h2>
  <div class="section" id="s-form-media">
<span id="s-topics-forms-media"></span><span id="form-media"></span><span id="topics-forms-media"></span><h1>Form Media<a class="headerlink" href="#form-media" title="Permalink to this headline">¶</a></h1>
<p>Rendering an attractive and easy-to-use web form requires more than just
HTML - it also requires CSS stylesheets, and if you want to use fancy
“Web2.0” widgets, you may also need to include some JavaScript on each
page. The exact combination of CSS and JavaScript that is required for
any given page will depend upon the widgets that are in use on that page.</p>
<p>This is where Django media definitions come in. Django allows you to
associate different media files with the forms and widgets that require
that media. For example, if you want to use a calendar to render DateFields,
you can define a custom Calendar widget. This widget can then be associated
with the CSS and JavaScript that is required to render the calendar. When
the Calendar widget is used on a form, Django is able to identify the CSS and
JavaScript files that are required, and provide the list of file names
in a form suitable for easy inclusion on your web page.</p>
<div class="admonition-media-and-django-admin admonition">
<p class="first admonition-title">Media and Django Admin</p>
<p>The Django Admin application defines a number of customized widgets
for calendars, filtered selections, and so on. These widgets define
media requirements, and the Django Admin uses the custom widgets
in place of the Django defaults. The Admin templates will only include
those media files that are required to render the widgets on any
given page.</p>
<p class="last">If you like the widgets that the Django Admin application uses,
feel free to use them in your own application! They’re all stored
in <tt class="docutils literal"><span class="pre">django.contrib.admin.widgets</span></tt>.</p>
</div>
<div class="admonition-which-javascript-toolkit admonition">
<p class="first admonition-title">Which JavaScript toolkit?</p>
<p class="last">Many JavaScript toolkits exist, and many of them include widgets (such
as calendar widgets) that can be used to enhance your application.
Django has deliberately avoided blessing any one JavaScript toolkit.
Each toolkit has its own relative strengths and weaknesses - use
whichever toolkit suits your requirements. Django is able to integrate
with any JavaScript toolkit.</p>
</div>
<div class="section" id="s-media-as-a-static-definition">
<span id="media-as-a-static-definition"></span><h2>Media as a static definition<a class="headerlink" href="#media-as-a-static-definition" title="Permalink to this headline">¶</a></h2>
<p>The easiest way to define media is as a static definition. Using this method,
the media declaration is an inner class. The properties of the inner class
define the media requirements.</p>
<p>Here’s a simple example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">CalendarWidget</span><span class="p">(</span><span class="n">forms</span><span class="o">.</span><span class="n">TextInput</span><span class="p">):</span>
    <span class="k">class</span> <span class="nc">Media</span><span class="p">:</span>
        <span class="n">css</span> <span class="o">=</span> <span class="p">{</span>
            <span class="s">'all'</span><span class="p">:</span> <span class="p">(</span><span class="s">'pretty.css'</span><span class="p">,)</span>
        <span class="p">}</span>
        <span class="n">js</span> <span class="o">=</span> <span class="p">(</span><span class="s">'animations.js'</span><span class="p">,</span> <span class="s">'actions.js'</span><span class="p">)</span>
</pre></div>
</div>
<p>This code defines a <tt class="docutils literal"><span class="pre">CalendarWidget</span></tt>, which will be based on <tt class="docutils literal"><span class="pre">TextInput</span></tt>.
Every time the CalendarWidget is used on a form, that form will be directed
to include the CSS file <tt class="docutils literal"><span class="pre">pretty.css</span></tt>, and the JavaScript files
<tt class="docutils literal"><span class="pre">animations.js</span></tt> and <tt class="docutils literal"><span class="pre">actions.js</span></tt>.</p>
<p>This static media definition is converted at runtime into a widget property
named <tt class="docutils literal"><span class="pre">media</span></tt>. The media for a CalendarWidget instance can be retrieved
through this property:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">w</span> <span class="o">=</span> <span class="n">CalendarWidget</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">w</span><span class="o">.</span><span class="n">media</span>
<span class="go">&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;</span>
<span class="go">&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;</span>
<span class="go">&lt;script type="text/javascript" src="http://media.example.com/actions.js"&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>Here's a list of all possible <tt class="docutils literal"><span class="pre">Media</span></tt> options. There are no required options.</p>
<div class="section" id="s-css">
<span id="css"></span><h3><tt class="docutils literal"><span class="pre">css</span></tt><a class="headerlink" href="#css" title="Permalink to this headline">¶</a></h3>
<p>A dictionary describing the CSS files required for various forms of output
media.</p>
<p>The values in the dictionary should be a tuple/list of file names. See
<a class="reference internal" href="#paths-in-media-definitions">the section on media paths</a> for details of how to specify paths to media
files.</p>
<p>The keys in the dictionary are the output media types. These are the same
types accepted by CSS files in media declarations: 'all', 'aural', 'braille',
'embossed', 'handheld', 'print', 'projection', 'screen', 'tty' and 'tv'. If
you need to have different stylesheets for different media types, provide
a list of CSS files for each output medium. The following example would
provide two CSS options -- one for the screen, and one for print:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Media</span><span class="p">:</span>
    <span class="n">css</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">'screen'</span><span class="p">:</span> <span class="p">(</span><span class="s">'pretty.css'</span><span class="p">,),</span>
        <span class="s">'print'</span><span class="p">:</span> <span class="p">(</span><span class="s">'newspaper.css'</span><span class="p">,)</span>
    <span class="p">}</span>
</pre></div>
</div>
<p>If a group of CSS files are appropriate for multiple output media types,
the dictionary key can be a comma separated list of output media types.
In the following example, TV's and projectors will have the same media
requirements:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Media</span><span class="p">:</span>
    <span class="n">css</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">'screen'</span><span class="p">:</span> <span class="p">(</span><span class="s">'pretty.css'</span><span class="p">,),</span>
        <span class="s">'tv,projector'</span><span class="p">:</span> <span class="p">(</span><span class="s">'lo_res.css'</span><span class="p">,),</span>
        <span class="s">'print'</span><span class="p">:</span> <span class="p">(</span><span class="s">'newspaper.css'</span><span class="p">,)</span>
    <span class="p">}</span>
</pre></div>
</div>
<p>If this last CSS definition were to be rendered, it would become the following HTML:</p>
<div class="highlight-python"><pre>&lt;link href="http://media.example.com/pretty.css" type="text/css" media="screen" rel="stylesheet" /&gt;
&lt;link href="http://media.example.com/lo_res.css" type="text/css" media="tv,projector" rel="stylesheet" /&gt;
&lt;link href="http://media.example.com/newspaper.css" type="text/css" media="print" rel="stylesheet" /&gt;</pre>
</div>
</div>
<div class="section" id="s-js">
<span id="js"></span><h3><tt class="docutils literal"><span class="pre">js</span></tt><a class="headerlink" href="#js" title="Permalink to this headline">¶</a></h3>
<p>A tuple describing the required JavaScript files. See
<a class="reference internal" href="#paths-in-media-definitions">the section on media paths</a> for details of how to specify paths to media
files.</p>
</div>
<div class="section" id="s-extend">
<span id="extend"></span><h3><tt class="docutils literal"><span class="pre">extend</span></tt><a class="headerlink" href="#extend" title="Permalink to this headline">¶</a></h3>
<p>A boolean defining inheritance behavior for media declarations.</p>
<p>By default, any object using a static media definition will inherit all the
media associated with the parent widget. This occurs regardless of how the
parent defines its media requirements. For example, if we were to extend our
basic Calendar widget from the example above:</p>
<div class="highlight-python"><pre>class FancyCalendarWidget(CalendarWidget):
    class Media:
        css = {
            'all': ('fancy.css',)
        }
        js = ('whizbang.js',)

&gt;&gt;&gt; w = FancyCalendarWidget()
&gt;&gt;&gt; print w.media
&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;link href="http://media.example.com/fancy.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/actions.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/whizbang.js"&gt;&lt;/script&gt;</pre>
</div>
<p>The FancyCalendar widget inherits all the media from it's parent widget. If
you don't want media to be inherited in this way, add an <tt class="docutils literal"><span class="pre">extend=False</span></tt>
declaration to the media declaration:</p>
<div class="highlight-python"><pre>class FancyCalendarWidget(CalendarWidget):
    class Media:
        extend = False
        css = {
            'all': ('fancy.css',)
        }
        js = ('whizbang.js',)

&gt;&gt;&gt; w = FancyCalendarWidget()
&gt;&gt;&gt; print w.media
&lt;link href="http://media.example.com/fancy.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://media.example.com/whizbang.js"&gt;&lt;/script&gt;</pre>
</div>
<p>If you require even more control over media inheritance, define your media
using a <a class="reference internal" href="#media-as-a-dynamic-property">dynamic property</a>. Dynamic properties give you complete control over
which media files are inherited, and which are not.</p>
</div>
</div>
<div class="section" id="s-media-as-a-dynamic-property">
<span id="media-as-a-dynamic-property"></span><h2>Media as a dynamic property<a class="headerlink" href="#media-as-a-dynamic-property" title="Permalink to this headline">¶</a></h2>
<p>If you need to perform some more sophisticated manipulation of media
requirements, you can define the media property directly. This is done
by defining a model property that returns an instance of <tt class="docutils literal"><span class="pre">forms.Media</span></tt>.
The constructor for <tt class="docutils literal"><span class="pre">forms.Media</span></tt> accepts <tt class="docutils literal"><span class="pre">css</span></tt> and <tt class="docutils literal"><span class="pre">js</span></tt> keyword
arguments in the same format as that used in a static media definition.</p>
<p>For example, the static media definition for our Calendar Widget could
also be defined in a dynamic fashion:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">CalendarWidget</span><span class="p">(</span><span class="n">forms</span><span class="o">.</span><span class="n">TextInput</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">_media</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">forms</span><span class="o">.</span><span class="n">Media</span><span class="p">(</span><span class="n">css</span><span class="o">=</span><span class="p">{</span><span class="s">'all'</span><span class="p">:</span> <span class="p">(</span><span class="s">'pretty.css'</span><span class="p">,)},</span>
                           <span class="n">js</span><span class="o">=</span><span class="p">(</span><span class="s">'animations.js'</span><span class="p">,</span> <span class="s">'actions.js'</span><span class="p">))</span>
    <span class="n">media</span> <span class="o">=</span> <span class="nb">property</span><span class="p">(</span><span class="n">_media</span><span class="p">)</span>
</pre></div>
</div>
<p>See the section on <a class="reference internal" href="#media-objects">Media objects</a> for more details on how to construct
return values for dynamic media properties.</p>
</div>
<div class="section" id="s-paths-in-media-definitions">
<span id="paths-in-media-definitions"></span><h2>Paths in media definitions<a class="headerlink" href="#paths-in-media-definitions" title="Permalink to this headline">¶</a></h2>
<p>Paths used to specify media can be either relative or absolute. If a path
starts with '/', '<a class="reference external" href="http:///">http://</a>' or '<a class="reference external" href="https:///">https://</a>', it will be interpreted as an absolute
path, and left as-is. All other paths will be prepended with the value of
<tt class="docutils literal"><span class="pre">settings.MEDIA_URL</span></tt>. For example, if the MEDIA_URL for your site was
<tt class="docutils literal"><span class="pre">http://media.example.com/</span></tt>:</p>
<div class="highlight-python"><pre>class CalendarWidget(forms.TextInput):
    class Media:
        css = {
            'all': ('/css/pretty.css',),
        }
        js = ('animations.js', 'http://othersite.com/actions.js')

&gt;&gt;&gt; w = CalendarWidget()
&gt;&gt;&gt; print w.media
&lt;link href="/css/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://othersite.com/actions.js"&gt;&lt;/script&gt;</pre>
</div>
</div>
<div class="section" id="s-media-objects">
<span id="media-objects"></span><h2>Media objects<a class="headerlink" href="#media-objects" title="Permalink to this headline">¶</a></h2>
<p>When you interrogate the media attribute of a widget or form, the value that
is returned is a <tt class="docutils literal"><span class="pre">forms.Media</span></tt> object. As we have already seen, the string
representation of a Media object is the HTML required to include media
in the <tt class="docutils literal"><span class="pre">&lt;head&gt;</span></tt> block of your HTML page.</p>
<p>However, Media objects have some other interesting properties.</p>
<div class="section" id="s-media-subsets">
<span id="media-subsets"></span><h3>Media subsets<a class="headerlink" href="#media-subsets" title="Permalink to this headline">¶</a></h3>
<p>If you only want media of a particular type, you can use the subscript operator
to filter out a medium of interest. For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">w</span> <span class="o">=</span> <span class="n">CalendarWidget</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">w</span><span class="o">.</span><span class="n">media</span>
<span class="go">&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;</span>
<span class="go">&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;</span>
<span class="go">&lt;script type="text/javascript" src="http://media.example.com/actions.js"&gt;&lt;/script&gt;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">w</span><span class="o">.</span><span class="n">media</span><span class="p">[</span><span class="s">'css'</span><span class="p">]</span>
<span class="go">&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;</span>
</pre></div>
</div>
<p>When you use the subscript operator, the value that is returned is a new
Media object -- but one that only contains the media of interest.</p>
</div>
<div class="section" id="s-combining-media-objects">
<span id="combining-media-objects"></span><h3>Combining media objects<a class="headerlink" href="#combining-media-objects" title="Permalink to this headline">¶</a></h3>
<p>Media objects can also be added together. When two media objects are added,
the resulting Media object contains the union of the media from both files:</p>
<div class="highlight-python"><pre>class CalendarWidget(forms.TextInput):
    class Media:
        css = {
            'all': ('pretty.css',)
        }
        js = ('animations.js', 'actions.js')

class OtherWidget(forms.TextInput):
    class Media:
        js = ('whizbang.js',)

&gt;&gt;&gt; w1 = CalendarWidget()
&gt;&gt;&gt; w2 = OtherWidget()
&gt;&gt;&gt; print w1.media + w2.media
&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/actions.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/whizbang.js"&gt;&lt;/script&gt;</pre>
</div>
</div>
</div>
<div class="section" id="s-media-on-forms">
<span id="media-on-forms"></span><h2>Media on Forms<a class="headerlink" href="#media-on-forms" title="Permalink to this headline">¶</a></h2>
<p>Widgets aren't the only objects that can have media definitions -- forms
can also define media. The rules for media definitions on forms are the
same as the rules for widgets: declarations can be static or dynamic;
path and inheritance rules for those declarations are exactly the same.</p>
<p>Regardless of whether you define a media declaration, <em>all</em> Form objects
have a media property. The default value for this property is the result
of adding the media definitions for all widgets that are part of the form:</p>
<div class="highlight-python"><pre>class ContactForm(forms.Form):
    date = DateField(widget=CalendarWidget)
    name = CharField(max_length=40, widget=OtherWidget)

&gt;&gt;&gt; f = ContactForm()
&gt;&gt;&gt; f.media
&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/actions.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/whizbang.js"&gt;&lt;/script&gt;</pre>
</div>
<p>If you want to associate additional media with a form -- for example, CSS for form
layout -- simply add a media declaration to the form:</p>
<div class="highlight-python"><pre>class ContactForm(forms.Form):
    date = DateField(widget=CalendarWidget)
    name = CharField(max_length=40, widget=OtherWidget)

    class Media:
        css = {
            'all': ('layout.css',)
        }

&gt;&gt;&gt; f = ContactForm()
&gt;&gt;&gt; f.media
&lt;link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;link href="http://media.example.com/layout.css" type="text/css" media="all" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://media.example.com/animations.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/actions.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://media.example.com/whizbang.js"&gt;&lt;/script&gt;</pre>
</div>
</div>
</div>



<div id="content-secondary">
  <h2 id="comments">Questions/Feedback</h2>
  <p>Having trouble? We'd like to help!</p>
  <ul>
    <li>
      Try the <a href="http://docs.djangoproject.com/en/dev/faq/">FAQ</a> — it's got answers to many common
      questions.
    </li>
    <li>
      Search for information in the <a href="http://groups.google.com/group/django-users/">archives of the
      django-users mailing list</a>, or <a href="http://groups.google.com/group/django-users/">post a question</a>.
    </li>
    <li>
      Ask a question in the <a href="irc://irc.freenode.net/">#django IRC
      channel</a>, or search the <a href="http://oebfare.com/logger/django/">IRC
      logs</a> to see if its been asked before.
    </li>
    <li>
      If you notice errors with this documentation, please <a href="http://code.djangoproject.com/simpleticket?component=Documentation">
      open a ticket</a> and let us know! Please only use the ticket tracker for
      criticisms and improvements on the docs. For tech support, use the
      resources above.
    </li>
  </ul>
</div>

		</div>
		<!-- END #content-main -->
		<div id="content-related" class="sidebar">
		
  
    <h2>Contents</h2>
    
      <ul>
<li><a class="reference external" href="">Form Media</a><ul>
<li><a class="reference external" href="#media-as-a-static-definition">Media as a static definition</a><ul>
<li><a class="reference external" href="#css"><tt class="docutils literal"><span class="pre">css</span></tt></a></li>
<li><a class="reference external" href="#js"><tt class="docutils literal"><span class="pre">js</span></tt></a></li>
<li><a class="reference external" href="#extend"><tt class="docutils literal"><span class="pre">extend</span></tt></a></li>
</ul>
</li>
<li><a class="reference external" href="#media-as-a-dynamic-property">Media as a dynamic property</a></li>
<li><a class="reference external" href="#paths-in-media-definitions">Paths in media definitions</a></li>
<li><a class="reference external" href="#media-objects">Media objects</a><ul>
<li><a class="reference external" href="#media-subsets">Media subsets</a></li>
<li><a class="reference external" href="#combining-media-objects">Combining media objects</a></li>
</ul>
</li>
<li><a class="reference external" href="#media-on-forms">Media on Forms</a></li>
</ul>
</li>
</ul>

    
  
  
  
    <h2>Search</h2>
    
    <form action="/en/1.0/search/" id="search" class="search">
  <div>
    <input name="cx" value="009763561546736975936:e88ek0eurf4" type="hidden">
    <input name="cof" value="FORID:11" type="hidden">
    <input name="ie" value="UTF-8" type="hidden">
    <input name="hl" value="" type="hidden">
    <input style="background: rgb(255, 255, 255) url(http://www.google.com/coop/intl/en/images/google_custom_search_watermark.gif) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" id="id_search_q" class="query" name="q" type="text">
    <input name="sa" class="submit" value="Search" type="submit">
    <ul>
<li><label for="id_search_as_q_0"><input checked="checked" id="id_search_as_q_0" value="more:dev_docs" name="as_q" type="radio"> Latest</label></li>
<li><label for="id_search_as_q_1"><input id="id_search_as_q_1" value="more:1.0_docs" name="as_q" type="radio"> 1.0</label></li>
<li><label for="id_search_as_q_2"><input id="id_search_as_q_2" value="more:0.96_docs" name="as_q" type="radio"> 0.96</label></li>
<li><label for="id_search_as_q_3"><input id="id_search_as_q_3" value="more:all_docs" name="as_q" type="radio"> All</label></li>
</ul>
  </div>
</form>
<script type="text/javascript" src="Django%20%7C%20Form%20Media%20%7C%20Django%20Documentation_files/brand.html"></script>
  
  
  
    <h2>Browse</h2>
    <ul>
      
        
          <li>Prev: <a href="http://docs.djangoproject.com/en/1.0/topics/forms/formsets/">Formsets</a></li>
        
        
          <li>Next: <a href="http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/">Creating forms from models</a></li>
        
        <li><a href="http://docs.djangoproject.com/en/1.0/contents/">Table of contents</a></li>
        
          <li><a href="http://docs.djangoproject.com/en/1.0/genindex/">General Index</a></li>
        
          <li><a href="http://docs.djangoproject.com/en/1.0/modindex/">Global Module Index</a></li>
        
      
    </ul>
  
  
  
    <h2>You are here:</h2>
    <ul>
      
        <li>
          <a href="http://docs.djangoproject.com/en/1.0/">Django 1.0 documentation</a>
          
            <ul><li><a href="http://docs.djangoproject.com/en/1.0/topics/">Using Django</a>
          
            <ul><li><a href="http://docs.djangoproject.com/en/1.0/topics/forms/">Working with forms</a>
          
          <ul><li>Form Media</li></ul>
          </li></ul></li></ul>
        </li>
      
    </ul>
  
  
  
    <h3>Last update:</h3>
    <div>May 23, 2009, 8:15 a.m. (<a href="http://www.timeanddate.com/worldclock/city.html?n=64">CDT</a>)</div>
  

		</div>
		<!-- END #content-related -->

		</div>
		<!-- END #content -->
		<div id="footer">
			<p>© 2005-2009 <a href="http://www.djangoproject.com/foundation/">Django Software Foundation</a> unless otherwise noted. Django is a registered trademark of the Django Software Foundation. 
			Hosting graciously provided by <a href="http://mediatemple.net/">
			<img style="vertical-align: middle; position: relative; top: -1px;" src="Django%20%7C%20Form%20Media%20%7C%20Django%20Documentation_files/mt.png" alt="media temple"></a>
			</p>
		</div>
		<!-- END #footer -->
	</div>
	<!-- END #container -->
	</body></html>